package DAO;

import java.util.ArrayList;

import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.Query;

import model.Cliente;
import model.Roles;

@Stateless
public class RolesDAO {
	@Inject 
	EntityManager em;
	public ArrayList<Roles> listar()
	{
		String sql="SELECT * FROM Roles";
		Query q = em.createNativeQuery(sql, Roles.class);
		return (ArrayList<Roles>) q.getResultList();
		
	}
	
	public void insertar(Roles rs)
	{
		em.persist(rs);
	}
	public Roles buscar(long id)
	{
		return em.find(Roles.class, id);
		
	}

}
